Hosting on GitHub Pages

May 2014
Sat 03
0
0
0

Free static web hosting and track changes?

Most of the projects I'm involved with, certainly the ones I've created are hosted on Sourceforge (SF). With SF, you create both project and user websites which come complete with a PHP backend. In recent times, people seem to moving away from SF and instead are using GitHub for projects and GitHub Pages for websites.

Advantages of using GitHub as a host:

  • Free! - No hosting fees
  • Site is a repository - Update content locally, commit and push the changes
  • Potentially easier than dealing with a hosting company, web portals and interfaces

With the above in mind and following the crowd, I thought I'd give it a go.

Sign up

I already had a GitHub account so I only needed to create a new repo called:

marcrobinson.github.io

then clone this repo to my local development directory (which I also sync through dropbox):

$ git clone https://github.com/marcrobinson/marcrobinson.github.io

Then it's simply a case of adding, committig and pushing changes from this directory:

$ git add index.html
$ git commit -m 'initial commit'
$ git push

The site can be accessed through http://marcrobinson.github.io, which in the case of this site redirects to ifnamemain.com.

To direct a custom domain to point at your GitHub page you will have to setup CNAME records. These records redirect from one domain to another. First a CNAME record is required in repository itself that simply contains your custom domain, i.e.

www.ifnamemain.com

Next you need your DNS server to point your domain at the GitHub page. To do this, you will need to log onto your domain name provider's control panel and add a CNAME record. In this record you can point your domain to your GitHub page:

www.ifnamemain.com -> marcrobinson.github.io

And that's it. Simple.




Comments